function patient = setup_patient_params(pt)
        
    %------------------------------------------------------------------------
    %   This file is part of the
    %   5D-Novel4DCT Toolbox  ("Novel4DCT-Toolbox")
    %   DH Thomas, Ph.D
    %   University of California, Los Angeles
    %   Contact: mailto:dhthomas@mednet.ucla.edu
    %------------------------------------------------------------------------
    % $Author: DHThomas $	$Date: 2014/04/01 10:23:59 $	$Revision: 0.1 $

    [patient]=choose_patient_toolbox(pt); % find patient data folders
    patient.pt = pt; %Patient number, for use in plots.
    [patient] = create_model_folders_toolbox(patient);%create model folders, and load static image and lung & body masks;
    %%
    patient.model_params_folder = [patient.model_folder '/model_params'];
    [patient.coronal_middle, patient.sagittal_left_middle, patient.sagittal_right_middle] = select_slices_to_plot(patient);
    [patient.bellows_volt, patient.ecg_volt, patient.scan_rate,patient.time, patient.directions,patient.scan_times, patient.scan_times_zerod]= read_sync_data_toolbox(patient);
    [patient.bellows_volt, patient.flow]=calculate_volume_flow_fit_toolbox(patient.bellows_volt, patient);    
    

    %%
    for scan = 1:patient.scans;
        for slice = 1:patient.dim(3);  
            if patient.bellows_volt(slice, scan)==0;
                patient.bellows_volt(slice, scan)=patient.bellows_volt(slice-1, scan);
            end
        end
    end
    
    patient.run_scans = find(all(patient.bellows_volt));
    patient.info_mhd = metaImageInfo([patient.folder_static '/' patient.static_image_name]);
    patient.info_mhd.ElementDataFile = [] 
    
   save([patient.folder '/patient'],'patient')